package com.wu.example;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.TextView;

public class Action2Activity extends BaseActivity {

	private static final String TAG = "Action2Activity";

	private Button btnGoto2 = null;
	private String msg = null;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.action1);

		msg = getIntent().getStringExtra(BrowserIntent.INTENT_FORWARD_TAG);
		TextView txtLable  = (TextView)this.findViewById(R.id.txtLabel1);
		txtLable.setText(msg);
		btnGoto2 = (Button) findViewById(R.id.btnGoto2);
		btnGoto2.setText("go back main activity");

		btnGoto2.setOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View v) {
				// 
				Intent i = new Intent();
				i.putExtra(BrowserIntent.INTENT_FORWARD_TAG, msg
						+ "\n click goto 2 button goto 2 action activity");
//				startActivityForResult(i, BrowserIntent.FORWARD_TO_1);
				setResult(BrowserIntent.RESULT_FROM_1, i);
				finish();
			}
		});
	}

	@Override
	protected void onActivityResult(int requestCode, int resultCode, Intent data) {
		Logger.debug(this, TAG, "onActivityResult");

	}
}
